<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>计算摘要</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.openssl-dh-compute-key.html">« openssl_dh_compute_key</a></li>
      <li style="float: right;"><a href="function.openssl-encrypt.html">openssl_encrypt »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.openssl.html">OpenSSL 函数</a></li>
    <li>计算摘要</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.openssl-digest" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">openssl_digest</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">openssl_digest</span> &mdash; <span class="dc-title">计算摘要</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.openssl-digest-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>openssl_digest</strong></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$method</code></span>, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$raw_output</code><span class="initializer"> = false</span></span>): <span class="type">string</span></div>

  <p class="para rdfs-comment">
   使用给定的方法计算给定数据的摘要哈希值，并返回一个原始的或16进制编码的字符串。
  </p>

  <div class="warning"><strong class="warning">警告</strong><p class="simpara">本函数还未编写文档，仅有参数列表。</p></div>

 </div>


 <div class="refsect1 parameters" id="refsect1-function.openssl-digest-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">data</code></dt>

     <dd>

      <p class="para">
       给定的数据。
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">method</code></dt>

     <dd>

      <p class="para">
       要使用的摘要方法，比如 &quot;sha256&quot;, 查看 <span class="function"><a href="function.openssl-get-md-methods.html" class="function">openssl_get_md_methods()</a></span> 函数获取更多可用的摘要方法。
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">raw_output</code></dt>

     <dd>

      <p class="para">
       为 <strong><code>true</code></strong> 时将会返回原始输出数据，否则返回值将会是16进制。
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.openssl-digest-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功，返回摘要哈希值， 或者在失败时返回 <strong><code>false</code></strong>.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.openssl-digest-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
   如果通过<code class="parameter">method</code>参数传递的是一个未知的摘要算法，将会抛出一个<strong><code>E_WARNING</code></strong> 级的错误。
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.openssl-digest-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.openssl-get-md-methods.html" class="function" rel="rdfs-seeAlso">openssl_get_md_methods()</a> - 获取可用的摘要算法</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>